﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %> 
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Import Namespace="Microsoft.SharePoint" %> 
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="AutoCompletionDemoTest.Layouts.AutoCompletionDemoTest.Test" DynamicMasterPageFile="~masterurl/default.master" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">    
    <style type="text/css">
        #map 
        {
          height:225px;
          width:400px;
          text-align:center;
        }
        .demo-container
        {
        	margin:3px;
        }
        .demo-control
        {
        	padding:3px;
        }
        .demo-mapcontrol 
        {
        	width:400px;
        	margin:auto;
        	border-style:solid;
        	border-width:thin;
        	border-color:InactiveBorder;
        	background-color:InfoBackground;
        }
    </style> 
    <script type="text/javascript">
        function RequestGeoState(source, eventArgs) {
            var state = document.getElementById('<%= InputFormTextBoxState.ClientID %>').value;
            PositionMap(state, 13);
        }
        function RequestGeoCityState(source, eventArgs) {
            var state = document.getElementById('<%= InputFormTextBoxState.ClientID %>').value;
            var city = document.getElementById('<%= InputFormTextBoxCity.ClientID %>').value;
            PositionMap(city + ", " + state, 10);
        }
        function PositionMap(location, zoom) {
            var map = new YMap(document.getElementById('map'));

            // Add map type control   
            map.addTypeControl();

            // Add map type control   
            map.addTypeControl();

            // Add map zoom (long) control   
            map.addZoomLong();

            // Add the Pan Control   
            map.addPanControl();

            // Set map type to either of: YAHOO_MAP_SAT, YAHOO_MAP_HYB, YAHOO_MAP_REG   
            map.setMapType(YAHOO_MAP_REG);

            // Display the map centered on a geocoded location   
            map.drawZoomAndCenter(location, zoom);
        }
        function ResetControls() {
            // Worthless trivia!! Lebanon, KS is te geographic center of the contiguous U.S.A.
            PositionMap("Lebanon, KS", 15);
            document.getElementById('<%= InputFormTextBoxState.ClientID %>').value = '';
            document.getElementById('<%= InputFormTextBoxCity.ClientID %>').value = '';
        }
        function _spBodyOnLoadWrapper() {
            ResetControls();
        }
    </script>
</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <div class="demo-control demo-container">
        <div class="demo-control demo-mapcontrol">
            <div id="map"></div>
            <h3>Please tell us about your location in the United States</h3>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <contenttemplate>
                    <p>   
                        <span class="demo-control">What is your state?</span>
                        <SharePoint:InputFormTextBox OnBlur="RequestGeoState(null,null);" ID="InputFormTextBoxState" OnTextChanged="InputFormTextBoxState_TextChanged" AutoPostBack="true" runat="server" />
                        <asp:PlaceHolder ID="PlaceHolderStateExtender" runat="server" />
                    </p>
                    <p>
                        <span class="demo-control">What is your city?&nbsp;&nbsp;</span>
                        <SharePoint:InputFormTextBox OnBlur="RequestGeoCityState(null,null);" ID="InputFormTextBoxCity" AutoPostBack="true" runat="server" />
                        <asp:PlaceHolder ID="PlaceHolderCityExtender" runat="server" />
                    </p>
                    <input type="button" value="Reset" onClick="ResetControls()"/>
                </contenttemplate>
            </asp:UpdatePanel>
        </div>
    </div>
    <!-- Please grab your own Yahoo developer id and use it here -->
    <script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=VCEy1.zV34Hkb2.Wd8vGjp3pfNYTAabr.yxPcN1GdoNukpl41GXUwQD2Tgup.Mfmv77a1w"/>
</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
AutoCompletionDemo Test Page
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
AutoCompletionDemo Test Page
</asp:Content>
